import qs from "qs"
import dayjs from "dayjs"
import { getUrlParams } from "./baseInfo"
import { fetchWrapper2 } from "./common"

const preDay = dayjs().subtract(1, "day").format("YYYY-MM-DD")
// mock版本
const gylMockVersion = getUrlParams("mockVersion") || ""
// 没有配置查询时间默认为前一天
const gylSearchDay = getUrlParams("searchDay") || preDay

/**仓库地图报表信息 */
export function statisticsOrderChartApi() {
  return fetchWrapper2<any>(
    `/psj-cloud-app/siteapi/screen/method=com.psj.cloud.site.screen.one`,
    {
      gylMockVersion,
      gylSearchDay,
      warehouseIds: ["102743510335520"],
      tenantId: "1000000004"
    },
    "POST"
  )
}

/**仓库地图信息 */
export function globalInfoApi() {
  const params = qs.stringify({
    mockVersion: gylMockVersion,
    date: gylSearchDay,
    warehouseIds: ["102743510335520"],
    tenantId: "1000000004"
  })
  return fetchWrapper2<any>(`/psj-cloud-app/wms/warehouse/banner-warehouse-v3?${params}`, undefined, "GET")
}
